#pragma once
#include "afxcmn.h"
#include "afxwin.h"

#include "ModelLayerView.h"
#include "ColoredListCtrl.h"


// CFindWireDlg dialog

class CFindWireDlg : public CDialogEx
{
	DECLARE_DYNAMIC(CFindWireDlg)

public:
	CFindWireDlg(CModelLayerView* pView, CWnd* pParent = NULL);
	virtual ~CFindWireDlg();

// Dialog Data
	enum { IDD = IDD_FIND_WIRE };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual BOOL OnInitDialog();
	virtual BOOL PreTranslateMessage(MSG* pMsg);

	DECLARE_MESSAGE_MAP()

public:
	afx_msg void OnBnClickedCheckWireStyle();
	afx_msg void OnBnClickedCheckSignalName();
	afx_msg void OnBnClickedButtonSearch();
	afx_msg void OnBnClickedButtonSelectAll();
	afx_msg void OnNMDblclkList1(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);

	afx_msg void OnOK();
	afx_msg void OnCancel();
	afx_msg void OnClose();
	afx_msg void OnDestroy();
	afx_msg void OnBnClickedFindInAllCheck();

	void GetAllWires();
	void CompareWireStyle(std::list<CWire*>& listWire);
	void CompareSignalName(std::list<CWire*>& listWire);
	void HighlightSelected(std::list<CWire*>& listSelected,bool bShowProp=true);

	void ListSelection();

private:
	CSystem* m_pBigDrawing;
	std::list<CWire*> m_listAllWires;
	std::list<CWire*> m_listResult;

	CModelLayerView* m_pView;
	HICON m_hIcon;

	CButton m_buttonWireStyle;
	CButton m_buttonSignalName;
	CComboBox m_comboWireStyle;
	CEdit m_editSignalName;
	CColoredListCtrl m_List;	
	BOOL m_bFindInAllData;

	CEdit m_FusszEdit;
	CString m_szEditFussz;
	CToolTipCtrl m_tooltip;
public:
	void FuzzySearch();
	void EnableFusszSearchEdit();
	bool FindByKeyword(list<CString> lstString, CString szFindName) const;
};
